package org.gruposp2p.proyectokarma.controller

import java.util.Date;
import grails.converters.JSON

class CometdChannelController {

    def insertData = {
        cometdChannelService.insertData();
    }
 
    def listData = {
        def channels
        def channelsMap = new HashMap()
        channels = cometdChannelService.listData();
        channelsMap.totalNumberOfChannels = channels.size()
        channelsMap.channels = channels.collect {channel ->
            return [channelId: channel.channelId, shortDescription:channel.shortDescription]
        }
        render channelsMap as JSON
    }
}

